function log(val){
    console.log(val);
}
var vm = new Vue({
    el: "#app",

    data: {
        items: [],
        itemsLen: '',
        totalPageNum: [],
        pageSize: '',
        currentPageNum: '',
    },

    filters: {
    },

    computed: {
    },

    mounted: function(){
       /* this.showList();*/
        this.getPager();
    },

    methods: {
        showList: function(){
            this.$http.get("/api/Role/getList").then(function(data){
                this.items = data.data.data;
                this.itemsLen = data.data.data.length;
            })
        },
        member_edit: function(title,url,id,w,h){
            layer_show(title,url+"/"+id,w,h);
        },
        getPager: function(n){
            this.$http.get("/api/Role/page",{pageNum : n, pageSize : this.pageSize}).then(function(data){
                this.totalPageNum = data.data.totalPageNum;
                this.pageSize = data.data.perPageSize;
                this.currentPageNum = data.data.currentPageNum;
                this.items = data.data.entitys;
            });
        },
        back: function(){
            if(this.currentPageNum != 1){
                this.$http.get("/api/Role/page",{pageNum : this.currentPageNum - 1, pageSize : this.pageSize}).then(function(data){
                    this.totalPageNum = data.data.totalPageNum;
                    this.pageSize = data.data.perPageSize;
                    this.currentPageNum = data.data.currentPageNum;
                    this.items = data.data.entitys;
                });
            }
        },
        go: function(){
            if(this.currentPageNum<this.totalPageNum){
                this.$http.get("/api/Role/page",{pageNum : this.currentPageNum + 1, pageSize : this.pageSize}).then(function(data){
                    this.totalPageNum = data.data.totalPageNum;
                    this.pageSize = data.data.perPageSize;
                    this.currentPageNum = data.data.currentPageNum;
                    this.items = data.data.entitys;
                });
            }
        }
    }
});
